<?php


namespace app\api\validate;

use think\Validate;

class UserValidate extends Validate
{

    protected $rule = [
        'user_name'=>'requireif:account_type,2|max:20',
        'school_name' => 'requireif:account_type,2|max:50',
        'school_address' => 'requireif:account_type,2',
        'mobile' => 'require|mobile|unique:user',
        'password' => 'require',
        'account_type' => 'require',
    ];
    protected $message = [
        'user_name.require' => '请输入用户名',
        'user_name.max:20' => '最大数字为20',
        'school_name.max:50' => '最大数字为50',
        'mobile.unique:user' => '只能在user表中使用',
        'mobile.require' => '请输入手机号',
        'password.require' => '请输入密码',
    ];
    protected $scene = [
        'register'=>['user_name','password','mobile','school_name','school_address','account_type']
    ];
}